<?php

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', [\App\Http\Controllers\TopicsController::class, "index"])->name("root");
Route::get('permission-denied', [\App\Http\Controllers\PagesController::class, "permissionDenied"])->name("permission-denied");

// 用户身份验证相关的路由
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');

// 用户注册相关路由
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');

// 密码重置相关路由
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');

// 再次确认密码（重要操作前提示）
Route::get('password/confirm', 'Auth\ConfirmPasswordController@showConfirmForm')->name('password.confirm');
Route::post('password/confirm', 'Auth\ConfirmPasswordController@confirm');

// Email 认证相关路由
Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}/{hash}', 'Auth\VerificationController@verify')->name('verification.verify');
Route::post('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');


// Route::get('/users/{user}', [\App\Http\Controllers\UsersController::class, "show"])->name('users.show');
// Route::get('/users/{user}/edit', [\App\Http\Controllers\UsersController::class, "edit"])->name('users.edit');
// Route::patch('/users/{user}', [\App\Http\Controllers\UsersController::class, "update"])->name('users.update');
// 等同以上三个
Route::resource('users', \App\Http\Controllers\UsersController::class, ['only' => ['show', 'update', 'edit']]);

Route::resource('topics', \App\Http\Controllers\TopicsController::class, ['only' => ['index', 'create', 'store', 'update', 'edit', 'destroy']]);
Route::get('topics/{topic}/{slug?}', [\App\Http\Controllers\TopicsController::class, 'show'])->name('topics.show');
Route::post('upload_image', [\App\Http\Controllers\TopicsController::class, 'uploadImage'])->name('topics.upload_image');

Route::resource('categories', \App\Http\Controllers\CategoriesController::class, ['only' => ['show']]);

Route::resource('replies', \App\Http\Controllers\RepliesController::class, ['only' => ['store', 'destroy']]);

Route::resource('notifications', \App\Http\Controllers\NotificationsController::class, ['only' => ['index']]);

Route::get('mofish/show', [\App\Http\Controllers\MoFishController::class, 'show'])->name('mofish.show');
